<!DOCTYPE html>
<html>

	<head>
		<title>班级网站</title>
		<meta charset="UTF-8">
		<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
		<script type="text/javascript" src="bootstrap-3.3.7-dist/js/bootstrap.js"></script>
		<link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.css" />
		<link rel="stylesheet" href="css/base.css" />
		<link rel="stylesheet" href="css/news.css" />
		<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
		<script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>
		<script type="text/javascript" src="js/Jump.js"></script>
	</head>

	<body style="background-color: rgb(239, 239, 239);">
	<div id="app">
		<header>
			<div style="width: 1000px; margin: auto;">
				<nav class="navbar navbar-inverse navbar-fixed-top">
					<div id="navbar" class="container">
						<div class="row">
							<div class="col-md-offset-4 col-md-5">
								<ul class="nav navbar-nav ">
									<li role="presentation"><a href="index.html">首页</a></li>
									<li role="presentation"><a href="classNews.html?page=classnews">班级新闻</a>
									</li>
									<li role="presentation"><a href="album.html">班级相册</a></li>
									<li role="presentation"><a href="classMembers.html">班级成员</a>
									</li>
								</ul>
							</div>
							<div class="col-md-3" id="user_box">
								<a href="personalCenter.html">个人中心</a>
							</div>
						</div>

					</div>
				</nav>
			</div>
		</header>

		<div class="container" style="margin-top:80px;">
			<div class="row">
				<div class="col-sm-3 col-md-3 l_box" style="padding: 0px;">
					<div id="class_notice">
						<div class="row">
							<div class="col-md-8">
								<h3>通知通告</h3>
							</div>
							<div class="col-md-3 pull-right">
								<a onclick="go_announce()" class="more">更多</a>
							</div>
						</div>
						<hr />
						<ul class="notice">
							<div v-for="(item,index) in list.announce" v-if="index < 5">
								<a :href="'article.html?id='+item.annold+'&page=announce'">
									<li><span>[12/4]</span>{{item.atitle}}</li>
								</a>
							</div>
						</ul>
					</div>
					<div id="homework">
						<div class="row">
							<div class="col-md-8">
								<h3>最新作业</h3>
							</div>
							<div class="col-md-3 pull-right">
								<a onclick="go_homework()" class="more">更多</a>
							</div>
						</div>
						<hr />
						<ul class="notice">
							<div v-for="(item,index) in list.homework" v-if="index < 5">
								<a :href="'article.html?id='+item.hid+'&page=homework'">
									<li><span>[12/4]</span>{{item.hTitle}}</li>
								</a>
							</div>

						</ul>
					</div>
					<div id="homework">
						<div class="row">
							<div>
								<h3 style="text-align: center; letter-spacing: 9px;">课程表</h3>
							</div>

						</div>
						<hr />
						<img src="img/class_schedule.png" width="100%" height="355px" />
					</div>
				</div>
				<div class="col-sm-8 col-md-8 thematic_section" style="padding: 0px;">
					
					<div id="news">
						<div class="row title_header">
							<div class="col-md-9">
								<h3>{{index}}</h3>
							</div>
						</div>
						<hr />
						<div>
							<ul>
								<li class="row" v-for="(item,index) in list.announce" v-if="flag==1">
									<a :href="'article.html?id='+item.annold+'&page=announce'">
										<div class="col-md-9" style="overflow: hidden;text-overflow: ellipsis; white-space: nowrap;">{{item.atitle}}</div>
										<div class="col-md-3">{{item.aDate}}</div>
									</a>
								</li>
								
								<li class="row" v-for="(item,index) in list.homework" v-if="flag==2">
									<a :href="'article.html?id='+item.hid+'&page=homework'">
										<div class="col-md-9" style="overflow: hidden;text-overflow: ellipsis; white-space: nowrap;">{{item.hCname}}</div>
										<div class="col-md-3">{{item.hbegin_date}}</div>
									</a>
								</li>
							
								<li class="row" v-for="(item,index) in list.classNews" v-if="flag==3">
									<a :href="'article.html?id='+item.cNID+'&page=classnews'">
										<div class="col-md-9" style="overflow: hidden;text-overflow: ellipsis; white-space: nowrap;">{{item.cNTile}}</div>
										<div class="col-md-3">{{item.cNTime}}</div>
									</a>
								</li>
							
								
							
							</ul>
							
						</div>
					</div>
				</div>
			</div>
		</div>
		<br />
		<footer class="jumbotron text-center" style="margin-bottom:0;background-color: #333333; position: relative;">
			<div style="color: white;">
				版权所有 &nbsp; &copy; 网络1714-小组7
			</div>
		</footer>
		
		</div>
		<script type="text/javascript">
			new Vue({
				el: '#app',
				data() {
					return {
						list:[],
						index:null,
						flag: 0
					}
				},
				mounted() {
					var result;
					var url = window.location.search; //获取url中"?"符后的字串  
					if(url.indexOf("?") != -1) {
						result = url.substr(url.indexOf("=") + 1);
					}
					if(result == "announce"){
						this.index="班级通知";
						this.flag=1;
					}
					else if(result == "homework"){
						this.index="班级作业";
						this.flag=2;
					}
					else if(result == "classnews"){
						this.index="班级新闻";
						this.flag=3;
					}
					
					axios.get('../ClassNewsServlet')
						.then(response => (
								this.list=response.data
								))
						.catch(function(error) { // 请求失败处理
							console.log(error);
						});
				}
			
			})
		</script>
		

	</body>

</html>